<?php
class MiddleResource{
	/**
	 * Fetch the Site's Content
	 */
	public function _curl_get($url){
		static $ch=null;
		if($ch === null){
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_HEADER, 0);
			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
		}
		curl_setopt($ch, CURLOPT_URL, $url);
		if(!$data = curl_exec($ch)){
			trigger_error(curl_error($ch));
		}

		return $data;
	}
}
